﻿using COMPONENT.Entity;
using COMPONENT.Library.Conexion;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace COMPONENT.Dao
{
    public class clsClienteDAO
    {
        private clsClienteDAO()
        {

        }

        private static clsClienteDAO instancia = null;
        public static clsClienteDAO Instancia
        {
            get
            {
                if (instancia == null)
                {
                    instancia = new clsClienteDAO();
                }
                return instancia;
            }
        }

        public bool GuardarCliente(clsCliente objcliente)
        {
            bool band = false;
            SqlCommand cmd = null;
            try
            {
                cmd = new SqlCommand("SP_GUARDAR_CLIENTE", clsConexion.GetConexion());
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@ID", objcliente.ID);
                cmd.Parameters.AddWithValue("@NOMBRES", objcliente.Nombre);
                cmd.Parameters.AddWithValue("@APELLIDOS", objcliente.Apellidos);
                cmd.Parameters.AddWithValue("@EMAIL", objcliente.Email);
                cmd.Parameters.AddWithValue("@PASSWORD", objcliente.Password);
                cmd.Parameters.AddWithValue("@GENERO", objcliente.Genero);
                cmd.Parameters.AddWithValue("@CREADOR", objcliente.CreadoPor);
                cmd.ExecuteNonQuery();
                band = true;
            }
            catch (Exception ex)
            {

            }
            return band;
        }
    }
}
